<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="hmg.common.ValueHolder"%>
<%@ page import="hmg.common.CommonUtils"%>
<%@ page import="hmg.vo.BoardVO"%>
<%@ page import="hmg.vo.FileVO"%>
<%@ page import="java.util.List"%>
<%--
    JSP Name : jspName.jsp
    Description : 설명을 기술합니다.
    author Kim hyung soo
    since 2012. 8. 15.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 8. 15.     Kim hyung soo     최초 생성
--%>
<%
    BoardVO news = (BoardVO) request.getAttribute("NewsInfo");
    List<FileVO> imageList = (List<FileVO>) request.getAttribute("ImageList");
    List<FileVO> attachedList = (List<FileVO>) request.getAttribute("AttachedList");
    BoardVO prevNews = (BoardVO) request.getAttribute("PrevNewsInfo");
    BoardVO nextNews = (BoardVO) request.getAttribute("NextNewsInfo");
    List<BoardVO> relatedNewsList = (List<BoardVO>) request.getAttribute("RelatedNewsList");
    boolean isHTML = false;
    String ogImageURL = "";

    String listID = request.getParameter("listID");
    String currPage = CommonUtils.getParameter(request.getParameter("page"), "1");
    String listType = CommonUtils.getParameter(request.getParameter("listType"), "0");
    String listFlag = CommonUtils.getParameter(request.getParameter("listFlag"), "");
    String compType = CommonUtils.getParameter(request.getParameter("compType"), "");

    if (news.getHTMLState().equals("Y") == true)
        isHTML = true;

    if (imageList != null && imageList.size() > 0)
        ogImageURL = ValueHolder.SERVER_DOMAIN + imageList.get(0).getFilePath();
    else
        ogImageURL = ValueHolder.SERVER_DOMAIN + ValueHolder.DEFAULT_IMAGE_PATH;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ko" xml:lang="ko" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>뉴스 | 현대자동차그룹</title>
<meta name="description" content="현대자동차그룹 보도자료, 뉴스 게시판" />
<meta name="keywords" content="그룹소식, 계열사소식, 제품/기술, 수상/활동, 공헌/환경, 문화/예술, 기타/마케팅" />
<%@ include file="/WEB-INF/jsp/web/kor/include/header.jspf" %>
<script type="text/javascript">
//<![CDATA[
var list_flag = "<%= listFlag %>";

<%  if (imageList != null && imageList.size() > 0) { %>
$(function() {
    var totalPanels = $(".scrollContainer").children().size();
    var movingDistance  = 484;
    var $panels = $('#gallery_slider .scrollContainer > div');
    var $container = $('#gallery_slider .scrollContainer');
    var curPanel = 0;
    var scroll = $('#gallery_slider .gallery_scroll').css('overflow', 'hidden');
    $panels.css({'float' : 'left','position' : 'relative'});
    $container.css('width', ($panels[0].offsetWidth * $panels.length) + 100 ).css('left', "0px");
    $("#gallery_slider").data("currentlyMoving", false);

    function change(direction, moveIndex) {
        if((direction && !(curPanel < totalPanels - 1)) || (!direction && (curPanel <= 0))) { return false; }
        if (($("#gallery_slider").data("currentlyMoving") == false)) {
            $("#gallery_slider").data("currentlyMoving", true);
            var next = direction ? curPanel + moveIndex : curPanel - moveIndex;
            var leftValue = $(".scrollContainer").css("left");
            var movement = direction ? parseFloat(leftValue, 10) - (movingDistance * moveIndex) : parseFloat(leftValue, 10) + (movingDistance * moveIndex);
            var curThumb = $("#thumbImg li.on");
            var removeClassEl = direction ? $(curThumb).next() : $(curThumb).prev();
            $(".scrollContainer").stop().animate({"left": movement}, function() {$("#gallery_slider").data("currentlyMoving", false);   });
            $(removeClassEl).addClass("on");
            $(curThumb).removeClass("on");
            curPanel = next;
        }
    }

    $("#thumbImg li").click(function(){
        if(!($(".scrollContainer").is(":animated"))){
            var curElSize = $("#thumbImg li.on").index();
            var clickElSize = $(this).index();
            if(curElSize !== clickElSize){
                if(curElSize > clickElSize){
                    change(false, (curElSize-clickElSize));
                }
                else if(curElSize < clickElSize){
                    change(true, (clickElSize-curElSize));
                }
                curPanel = clickElSize;
                $("#thumbImg li").removeClass("on");
                $(this).addClass("on");
            }
        }
    });

    function thumb(){
        var thumbW = $("#thumbImg li img").width();
        var thumbW2 = thumbW + 8;
        var thumbImgCont = $("#thumbImg ul");
        var count = 1;

        $(".right").click(function(){
            var curElSize = $("#thumbImg li.on").index();
            if(curElSize == 7){
                count++;
                $("#thumbImg ul").css("left", -thumbW2*count + "px");
            }
            change(true, 1);
        });

        $(".left").click(function(){
            var curElSize = $("#thumbImg li.on").index();
            if(curElSize == 2){
                count--;
                thumbImgCont.css("left","0");
            }
            change(false, 1);
        });
    }
    thumb();

});
<%  } %>

function fn_go_to_list() {
    if (list_flag == "1")
        document.location.href = "./NewsList.do?listID=<%= listID %>&listType=<%= listType %>&compType=<%= compType %>&page=<%= currPage %>";
    else
        document.location.href = "./NewsImageList.do?listID=<%= listID %>&listType=<%= listType %>&compType=<%= compType %>&page=<%= currPage %>";
}

function fn_print_news() {
    window.open('./NewsViewPrint.do?listType=0&listID=<%= news.getListID() %>','현대자동차그룹공식홈페이지','scrollbars=yes, toolbar=yes, width=745, height=650');
}

//]]>
</script>
<meta property="og:type"        content="article" />
<meta property="og:url"         content="<%= ValueHolder.SERVER_DOMAIN + request.getAttribute("javax.servlet.forward.request_uri") + "?" + request.getQueryString() %>" />
<meta property="og:title"       content="<%= news.getTitle() %>" />
<meta property="og:description" content="<%= CommonUtils.getPlainText(news.getWebContent(), true, 100) %>" />
<meta property="og:image"       content="<%= ogImageURL %>" />
</head>
<body>
    <!--wrap-->
    <div id="wrap">
        <!-- skip navigation -->
        <div id="skipnavition">
            <a href="#gnb">메뉴바로가기</a><a href="#content">본문바로가기</a>
        </div>
        <!--// skip navigation -->

        <hr />

        <!-- header-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/left.jspf" %>
        <!--//header-->

        <hr />

        <!--container-->
        <div id="container">
            <div class="scroll-pane">
            <!-- 공통 -->
            <div class="subTitle">
                <div class="pageTitle">
                    <h2><img src="/hmg/images/web/kor/title/group_News_List.gif" alt="뉴스" /></h2>
                    <p class="subCopy"><img src="/hmg/images/web/kor/title/group_News_List_desc.gif" alt="그룹의 생생한 뉴스를 담은 보도자료" /></p>
                </div>

                <div class="pageLocation">
                    <ul>
                        <li><a href="/hmg/web/kor/Main.do"><img src="/hmg/images/web/kor/common/location_home.gif" alt="홈"/></a></li>
                        <li><a href="/hmg/web/kor/grn/GroupNewsSubMain.do">그룹소식</a></li>
                        <li class="nowPage"><a href="/hmg/web/kor/grn/nws/NewsList.do">뉴스</a></li>
                    </ul>
                </div>
            </div>
            <!--//공통-->

            <!--contents-->
            <div id="content">

            <!-- 내용 -->
            <div class="groupNews">

                <div class="view_Icon">
                    <a href="javascript:fn_share_facebook(document.location, '<%= news.getTitle() %>');"><img src="/hmg/images/web/kor/common/icon_facebook.gif" alt="페이스북" /></a>
                    <a href="javascript:fn_share_twitter(document.location, '<%= news.getTitle() %>');"><img src="/hmg/images/web/kor/common/icon_twitter.gif" alt="트위터" /></a>
                    <a href="javascript:fn_print_news();"><img src="/hmg/images/web/kor/btn/btn_print.gif" alt="Print" /></a>
                    <a href="#" onclick="javascript:fn_font_size(1);"><img src="/hmg/images/web/kor/btn/text_Sizeup.gif" alt="글자 크게" /></a>
                    <a href="#" onclick="javascript:fn_font_size(-1);"><img src="/hmg/images/web/kor/btn/text_Sizedown.gif" alt="글자 작게" /></a>
                </div>

                <div class="view_table01">
                    <table summary="뉴스 보기 테이블">
                    <caption>뉴스 보기</caption>
                    <colgroup>
                        <col width="12%" /><col width="78%" /><col width="10%" />
                    </colgroup>
                    <tbody>
                        <tr>
                            <th colspan="3"><%= news.getTitle() %></th>
                        </tr>
                        <tr>
                            <td colspan="2"><%= news.getCompName() %></td>
                            <td class="align_right"><%= news.getExpireDate() == null ? "" : news.getExpireDate() %></td>
                        </tr>
                        <tr>
                            <td colspan="3"<%= attachedList != null && attachedList.size() > 0 ? " class=\"brd_dash\"" : "" %>>
<%  if (imageList != null && imageList.size() > 0) { %>
                                <div class="viewTable_Slide">
                                    <div id="gallery_wrapper">
                                        <div id="gallery_slider">
                                            <div style="overflow: hidden;" class="gallery_scroll">
                                                <div class="scrollContainer">
<%
        for (int idx = 0; idx < imageList.size(); idx++) {
            FileVO image = imageList.get(idx);
%>
                                                    <div class="gallery_panel">
                                                        <img src="<%= image.getFilePath() %>" alt="" />
                                                    </div>
<%      } %>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="arrow">
                                        <span class="left"><img class="png24"src="/hmg/images/web/kor/grn/left_arrow.gif" alt="left"/></span>
                                        <span class="right"><img class="png24"src="/hmg/images/web/kor/grn/right_arrow.gif" alt="right"/></span>
                                    </div>

                                    <div id="thumbImg">
                                        <ul>
<%
        for (int idx = 0; idx < imageList.size(); idx++) {
            FileVO image = imageList.get(idx);

            if (idx == 0)
                out.println("                                            <li class=\"on\"><img src=\"" + image.getFilePath() + "\" alt=\"\" /></li>");
            else if (idx + 1 == imageList.size())
                out.println("                                            <li class=\"last\"><img src=\"" + image.getFilePath() + "\" alt=\"\" /></li>");
            else
                out.println("                                            <li><img src=\"" + image.getFilePath() + "\" alt=\"\" /></li>");
        }
%>
                                        </ul>
                                    </div>
                                </div>
<%  } %>
                                <p id="content_p"><%= CommonUtils.getWebText(news.getWebContent(), isHTML) %></p>
                            </td>
                        </tr>
<%  if (attachedList != null && attachedList.size() > 0) { %>
                        <tr>
                            <th class="downloadFile"><img src="/hmg/images/web/kor/grn/download_Text.gif" alt="첨부파일"/></th>
                            <td colspan="2" class="last">
<%
        for (int idx = 0; idx < attachedList.size(); idx++) {
            FileVO attached = attachedList.get(idx);

            out.println("<a href=\"/hmg/web/kor/com/DownloadFile.do?fileSeq=" + attached.getFileSeq() + "\">&nbsp;&nbsp;<img src=\"/hmg/images/web/kor/common/icon_Download.gif\" alt=\"첨부파일\" /> " + attached.getOriginalFileName() + "</a><br />");
        }
%>
                            </td>
                        </tr>
<%  } %>
                    </tbody>
                    </table>
                </div>

                <div class="view_table02">
                    <table summary="뉴스 보기 목록 테이블">
                    <caption>뉴스 보기 목록</caption>
                    <colgroup>
                        <col width="12%" /><col width="88%" />
                    </colgroup>
                    <tbody>
                        <tr>
                            <th><img src="/hmg/images/web/kor/grn/prevList.gif" alt="이전글"/></th>
                            <td>
<%
    if (prevNews != null)
        out.println("                                <a href=\"./NewsView.do?listID=" + prevNews.getListID() + "&listType=" + listType + "&listFlag=" + listFlag + "&compType=" + compType + "&page=" + currPage + "\">" + prevNews.getCompName() + " " + prevNews.getTitle() + "</a>");
    else
        out.println("                                이전 글이 존재하지 않습니다.");
%>
                            </td>
                        </tr>
                        <tr>
                            <th class="last"><img src="/hmg/images/web/kor/grn/nextList.gif" alt="다음글"/></th>
                            <td class="last">
<%
    if (nextNews != null)
        out.println("                                <a href=\"./NewsView.do?listID=" + nextNews.getListID() + "&listType=" + listType + "&listFlag=" + listFlag + "&compType=" + compType + "&page=" + currPage + "\">" + nextNews.getCompName() + " " + nextNews.getTitle() + "</a>");
    else
        out.println("                                다음 글이 존재하지 않습니다.");
%>
                            </td>
                        </tr>
                    </tbody>
                    </table>
                </div>

                <div class="btnWrap">
                    <div class="align_right">
                        <a href="javascript:fn_go_to_list();"><img src="/hmg/images/web/kor/btn/btn_list02.gif" alt="목록" /></a>
                    </div>
                </div>

<%  if (relatedNewsList != null && relatedNewsList.size() > 0) { %>
                <div class="relation_Article">
                    <p class="title"><img src="/hmg/images/web/kor/grn/article_Title.gif" alt="관련기사"/> <span><%= news.getCompName() %></span></p>
                    <ul>
<%
        for (int idx = 0; idx < relatedNewsList.size(); idx++) {
            BoardVO relatedNews = relatedNewsList.get(idx);

            if (idx + 1 == relatedNewsList.size())
                out.println("                        <li class=\"last\">");
            else
                out.println("                        <li>");
%>
                            <dl>
                                <dt><a href="./NewsView.do?listID=<%= relatedNews.getListID() %>&listType=<%= listType %>&compType=<%= compType %>&listFlag=<%= listFlag %>&page=1"><%= relatedNews.getTitle() %></a></dt>
                                <dd><a href="./NewsView.do?listID=<%= relatedNews.getListID() %>&listType=<%= listType %>&compType=<%= compType %>&listFlag=<%= listFlag %>&page=1"><img src="<%= relatedNews.getThumbnailImage() %>" alt="관련기사" /></a></dd>
                            </dl>
                        </li>
<%      } %>
                    </ul>
                </div>
<%  } %>
            </div>
            <!--// 내용 -->


            </div>
            <!--//contents-->
        </div>
        </div>
        <!--//container-->

        <hr />

        <!--footer-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/footer.jspf" %>
        <!--//footer-->

        <hr />

        <!--notice-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/notice.jspf" %>
        <!--//notice-->
    </div>
    <!--//wrap-->
</body>
</html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              